
{% extends 'myadmin/public/base.html' %}

{% block title %}
<title>后台订单列表</title>
{% endblock %}

{% block header %}
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
            <div class="page-header-heading">
                <span class="am-icon-home page-header-heading-icon"></span> 
                订单列表 <small>Amaze UI</small>
            </div>
        </div>
    </div>
{% endblock %}


{% block con %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">商品订单列表</div>


                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                </div>
                            </div>
                        </div>
                    </div>

                <form>
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                        <div class="am-form-group tpl-table-list-select">
                            <select name="type" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                              <option value="all" {% if request.GET.type == 'all' %} selected {% endif %} >所有条件</option>
                              <option value="status" {% if request.GET.type == 'status' %} selected {% endif %} >订单状态</option>
                                                         
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" name="keywords" class="am-form-field " placeholder="请输入状态码0,1,2,3" value="{{ request.GET.keywords }}">
                            <span class="am-input-group-btn">
                            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
                          </span>
                        </div>
                    </div>
                </form>


                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr> 
                                    <th>订单编号</th>
                                    <th>用户</th>
                                    <th>图片</th>
                                    <th>商品</th>
                                    <th>单价</th>
                                    <th>数量</th>
                                    <th>总价</th>
                                    <th>状态</th>
                                    <th>订单时间</th>
                                    <th>地址</th>
                                    <th>操作</th>
                                    
                                    
                                </tr>
                            </thead>
                            <tbody>
                            {% for v in orderlist %}
                                <tr>
                                    {% for goods in v.orderinfo_set.all %}
                                    <td class="am-text-middle" name="id">{{ v.id }}</td>
                                    <td class="am-text-middle">{{ v.uid.username|default:v.uid.phone }}</td>
                                    <td>
                                        <img src="{{ goods.goodsid.pic }}" class="tpl-table-line-img" alt="">
                                    </td>
                                    <td class="am-text-middle">{{ goods.goodsid.title }}</td>
                                    <td class="am-text-middle">{{ goods.goodsid.price }}</td>
                                    <td class="am-text-middle">{{ goods.num }}</td>
                                    <td class="am-text-middle" name="totalprice">{{ v.totalprice }}</td>
                                    <td class="am-text-middle">
                                        {% if v.status == 0 %}
                                        未付款
                                        {% elif v.status == 1 %}
                                        未发货
                                        {% elif v.status == 2 %}
                                        未收货
                                        {% elif v.status == 3 %}
                                        未评价
                                        {% endif %}
                                    </td>
                                    <td class="am-text-middle" name="addtime">{{ v.addtime|date:"Y-m-d H:i:s" }}</td>
                                    
                                    <td class="am-text-middle">{{ v.addressid.address }}</td>
                                    
                                    
                                    <!-- 修改 -->
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="?orderid={{ v.id }}">
                                                <i class="am-icon-pencil"></i> 修改
                                            </a>
                                           
                                        </div>
                                    </td>
                                    {% endfor %}
                                </tr>
                            {% endfor %}
                        
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                         
                                <!-- <li><a href="#">»</a></li> --> -->
                                {% load pagetag %}

                                {% showpage orderlist.paginator.num_pages request %}    
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock%}